<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Apply</title>
</head>
<body>
    <script>
        function myApply(fn, target, args) {
            target = target || {};
            target.fn = fn;
            return target.fn(...args);
        }
        function print(x){
            console.log(x);
        }
        myApply(print, null, [2]);
    </script>
</body>
</html>